@import './common/var.css';

$van-checkbox-size: 20px;

.van-checkbox {
  overflow: hidden;
  user-select: none;

  .van-icon-success {
    color: $white;
    display: block;
    font-size: 12px;
    text-align: center;
    pointer-events: none;
    border: 1px solid #aaa;
    width: $van-checkbox-size;
    height: $van-checkbox-size;
    box-sizing: border-box;

    &::before {
      margin: 0 auto;
      line-height: $van-checkbox-size;
    }
  }

  &__input,
  &__label {
    display: inline-block;
    vertical-align: middle;
  }

  &__input {
    position: relative;
    height: $van-checkbox-size;
  }

  &__control {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    margin: 0;
    width: 100%;
    height: 100%;
  }

  &__label {
    margin-left: 10px;
    line-height: $van-checkbox-size;
  }

  &--round {
    .van-icon-success {
      border-radius: 100%;
    }
  }

  &__control:checked + .van-icon-success {
    border-color: $green;
    background-color: $green;
  }

  &--disabled {
    .van-icon-success {
      color: $background-color;
      border-color: $gray-light;
      background-color: currentColor;
    }

    .van-checkbox__control:checked + .van-icon-success {
      border-color: $gray-light;
      background-color: $gray-light;
    }
  }
}
